import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  },
  server: {
    //配置代理
    proxy: {
      "^/socket": {
        //目标地址
        target: "ws://127.0.0.1:8080", //WS地址
        //开启跨域
        changeOrigin: true,
        ws: true,
        rewrite: (path) => path.replace(/^\/socket/, ""),
      },
    },
  }
})
